package com.code.monitor.listener;

import com.code.monitor.constants.RuntimeType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class ServiceRunner implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        List<String> list = args.getOptionValues("runtime");
        if (list.contains(RuntimeType.MEMORY.getType())) {
            log.info("启用memory存储");
        } else if (list.contains(RuntimeType.MYSQL.getType())) {
            log.info("启用mysql存储");
        } else {
            log.info("启用memory存储");
        }
    }
}
